<!DOCTYPE html>
<html dir="ltr" lang="en" xmlns:th="http://www.thymeleaf.org">

<!--引入头部设置部分-->
<head th:replace="share/common::head('电商平台-用户管理')"></head>

<body>

<div id="main-wrapper">

    <!--引用头部部分-->
    <div th:replace="share/common::header"></div>

    <!--引用侧边栏部分-->
    <div th:replace="share/common::aside"></div>

    <!--内容部分-->
    <div class="page-wrapper">

        <!--站点地图-->
        <div class="page-breadcrumb">
            <div class="row">
                <div class="col-12 d-flex no-block align-items-center">
                    <h4 class="page-title">用户列表</h4>
                    <div class="ml-auto text-right">
                        <nav aria-label="breadcrumb">
                            <ol class="breadcrumb">
                                <li class="breadcrumb-item"><a th:href="@{/index}">Home</a></li>
                                <li class="breadcrumb-item active" aria-current="page">用户管理</li>
                                <li class="breadcrumb-item active" aria-current="page">用户列表</li>
                            </ol>
                        </nav>
                    </div>
                </div>
            </div>
        </div>

        <!--页面内容-->
        <div class="container-fluid">
            <div class="row">
                <div class="col-12">

                    <form id="form1" th:action="@{/user/index}" th:model_path="@{/user}" method="post"
                          class="form-horizontal">
                        <div>
                            <div class="form-group row">
                                <label for="username"
                                       class="col-sm-1 text-left control-label col-form-label">用户名称</label>
                                <div class="col-sm-2">
                                    <input type="text" id="username" name="username" th:value="${condition.username}"
                                           placeholder="请输入品牌名称" class="form-control">
                                </div>

                            </div>

                        </div>

                        <div class="card">
                            <table class="table">
                                <thead>
                                <tr>
                                    <th scope="col">编号</th>
                                    <th scope="col">用户名称</th>


                                </tr>
                                </thead>
                                <tbody>
                                <tr th:each="user:${pager.datas}">
                                    <th scope="row" th:text="${userStat.index+1}"></th>
                                    <td th:text="${user.username}"></td>
                                    <td>
                                    <span th:if="${user.username!='admin'}">
                                            <button type="button" onclick="btn_detail_submit(this)" th:id="${user.id}" class="btn btn-outline-primary btn-sm">详情</button>
                                               <button type="button" onclick="btn_modify_submit(this)" th:id="${user.id}" class="btn btn-outline-primary btn-sm">修改</button>
                                            <button type="button"  onclick="btn_remove_submit(this)" th:id="${user.id}" class="btn btn-outline-primary btn-sm">删除</button>
                                        </span>
                                    </td>
                                </tr>
                                </tbody>
                                <tfoot>
                                <tr>
                                    <td colspan="2">
                                        共&nbsp;[[${pager.size}]]&nbsp;条&nbsp;&nbsp;
                                        第&nbsp;[[${pager.page}]]&nbsp;页&nbsp;&nbsp;
                                        共&nbsp;[[${pager.pages}]]&nbsp;页&nbsp;&nbsp;
                                        [[${pager.page_size}]]&nbsp;条&nbsp;/&nbsp;页
                                    </td>
                                    <td colspan="5" class="text-right">
                                        <button onclick="split_submit(this)" th:page="${pager.first}"
                                                class="btn btn-outline-primary btn-sm m-1">首页
                                        </button>
                                        <button onclick="split_submit(this)" th:page="${pager.pre}"
                                                class="btn btn-outline-primary btn-sm m-1">上一页
                                        </button>
                                        <button onclick="split_submit(this)" th:page="${current}"
                                                th:each="current:${pager.page_array}" th:text="${current}"
                                                th:class="${current==pager.page?'btn btn-primary btn-sm m-1':'btn btn-outline-primary btn-sm m-1'}">
                                            1
                                        </button>
                                        <button onclick="split_submit(this)" th:page="${pager.next}"
                                                class="btn btn-outline-primary btn-sm m-1">下一页
                                        </button>
                                        <button onclick="split_submit(this)" th:page="${pager.last}"
                                                class="btn btn-outline-primary btn-sm m-1">末页
                                        </button>
                                    </td>
                                </tr>
                                </tfoot>
                            </table>
                        </div>
                    </form>

                </div>
            </div>
        </div>

        <!--引用网页脚部-->
        <div th:replace="share/common::footer"></div>

    </div>

</div>

<!--引用JS资源部分-->
<div th:replace="share/common::js_resources"></div>

<script th:src="@{/js/button.js}"></script>
<script th:src="@{/js/split.js}"></script>
</body>

</html>